import Router from 'koa-router';
import proxyService from '../../../common/proxyService';
const router = new Router();
import {
  getUserInfoRank,
  posterRank,
  listRank,
  rankRank,
  get_share_paramRank,
  getFansPosterImageByIdRank,
  getRankAuthInfo,
} from '../../../api';

router.get('/getUserInfoRank', async ctx => {
  const response = await proxyService.postProxy(ctx, getUserInfoRank);
  return (ctx.body = response);
});
// 进入排行榜获取授权信息
router.get('/getRankAuthInfo', async ctx => {
  const response = await proxyService.postProxy(ctx, getRankAuthInfo);
  return (ctx.body = response);
});
router.get('/posterRank', async ctx => {
  let params = ctx.request.query;
  params.appAccountId = Number(params.appAccountId);
  const response = await proxyService.postProxy(ctx, posterRank, { params });
  return (ctx.body = response);
});
router.get('/listRank', async ctx => {
  let params = ctx.request.query;
  params.appAccountId = Number(params.appAccountId);
  params.offset = Number(params.offset);
  params.limit = Number(params.limit);
  const response = await proxyService.postProxy(ctx, listRank);
  return (ctx.body = response);
});
router.get('/rankRank', async ctx => {
  let params = ctx.request.query;
  params.appAccountId = Number(params.appAccountId);
  const response = await proxyService.postProxy(ctx, rankRank, { params });
  return (ctx.body = response);
});
router.get('/get_share_paramRank', async ctx => {
  console.log(ctx.request.query);
  const response = await proxyService.postProxy(ctx, get_share_paramRank);
  return (ctx.body = response);
});
router.get('/getFansPosterImageByIdRank', async ctx => {
  const response = await proxyService.postProxy(ctx, getFansPosterImageByIdRank);
  return (ctx.body = response);
});
export default router;
